package bTree.LeetCode;

public class 把二叉搜索树转为累加树 {
    int value = 0;

    public TreeNode convertBST(TreeNode root) {
        if (root == null) {
            return null;
        }
        convertBST(root.right);
        int temp=root.val;
        root.val += value;
        value += temp;
        convertBST(root.left);
        return root;
    }
}